package com.qf.controller;/*
 *保护你的大熊
 *2021/12/20
 *11:57
 */

import com.qf.pojo.Goods;
import org.springframework.web.bind.annotation.*;

@RestController
public class GoodsController {

    @RequestMapping("/index")
    public String index(){
        System.out.println(1/0);
        return "获取商品: 9001";
    }

    @GetMapping("/findById/{goodsId}")
    public Goods findById(@PathVariable("goodsId") Integer id){
        return new Goods(id,"手办",System.currentTimeMillis());
    }

    @GetMapping("/findById")
    public Goods findById2(Integer id){
        System.out.println(1/id);
        return new Goods(id,"手办",500);
    }

    @PostMapping("/save")
    public String save(Goods goods){
        System.out.println("保存商品对象：" + goods);
        return "success";
    }
}
